<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>统计系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="http://api.uomg.com/assets/css/site.min.css">
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <link rel="stylesheet" href="/static/css/swiper.min.css">
    <script type="text/javascript" src="/static/js/jquery.js"></script>
    <script type="text/javascript" src="/static/js/swiper.jquery.min.js"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <style>
        a {
            text-decoration: none !important;
        }

        .layui-input-inline span {
            /*background-color: black !important;*/
        }
    </style>

</head>
<body>
<!-- 顶部开始 -->
<div class="container">
    <div class="logo"><a href="/">统计平台</a></div>
    <div class="open-nav"><i class="iconfont">&#xe699;</i></div>
</div>
<!-- 顶部结束 -->
<!-- 中部开始 -->
<div class="wrapper">
    <!-- 左侧菜单开始 -->
    <div class="left-nav">
        <div id="side-nav">
            <ul id="nav">
                <#if menus??>
                <#list menus as menu1>
                    <li class="list">
                        <a href="javascript:;">
                            <i class="iconfont">&#xe6a3;</i>
                            ${menu1.name}
                            <i class="iconfont nav_right">&#xe697;</i>
                        </a>
                        <ul class="sub-menu" style="display:none">

                          <#list menu1.menus as menu2>
                              <li class="list">
                                  <a href="javascript:;">
                                      ${menu2.name}
                                      <i class="iconfont nav_right">&#xe697;</i>
                                  </a>
                                  <ul class="sub-menu sub-menu2" style="display:none">
                                           <#list menu2.menus as menu3>
                                               <li class="list open">
                                                   <a href="/show?url= ${menu3.url}">
                                                       <i class="iconfont">&#xe6a7;</i>
                                                       ${menu3.name}
                                                   </a>
                                               </li>
                                           </#list>
                                  </ul>
                              </li>
                          </#list>
                        </ul>
                    </li>
                </#list>
                </#if>
            </ul>
        </div>
    </div>
    <!-- 左侧菜单结束 -->
    <!-- 右侧主体开始 -->
    <div class="page-content">
        <div class="content">
            <div class="down">
                <button id="dm" class="layui-btn layui-btn-danger">菜单数据下载</button>
            </div>
            <article class="markdown-body tab-pane fade in active" id="api">
                <div class="api-sub-content" style="background-color: #fff;padding: 10px">
                    <div class="simpleline"><strong>接口地址：</strong><span
                            class="url">http://127.0.0.1:8080/statistics</span>
                    </div>
                    <div class="simpleline"><strong>返回格式：</strong><span class="url">json/images</span></div>
                    <div class="simpleline"><strong>请求方式：</strong><span class="url">get</span></div>
                    <div class="simpleline"><strong>请求示例：</strong><span class="url">http://127.0.0.1:38080/statistics?module=小程序统计&interface=Helen&name=jkjk&type=1</span>
                    </div>
                    <div class="simpleTable">
                        <p class="linep">请求参数说明：</p>
                        <table class="api-table" border="0" cellspacing="0" cellpadding="0">
                            <tbody>
                            <tr class="title">
                                <th width="20"></th>
                                <th width="100">名称</th>
                                <th width="60">必填</th>
                                <th width="80">类型</th>
                                <th>说明</th>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td class="url">module</td>
                                <td class="url">true</td>
                                <td class="url">get</td>
                                <td>模块名,不能包含特殊符号</td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td class="url">interface</td>
                                <td class="url">true</td>
                                <td class="url">get</td>
                                <td>归属名,不能包含特殊符号</td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td class="url">name</td>
                                <td class="url">true</td>
                                <td class="url">get</td>
                                <td>谁的数据,不能包含特殊符号</td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                                <td class="url">type</td>
                                <td class="url">true</td>
                                <td class="url">get</td>
                                <td>1，成功数，0，失败数</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="simpleTable">
                        <p class="linep">返回参数说明：</p>
                        <table class="api-table" border="0" cellspacing="0" cellpadding="0">
                            <tbody>
                            <tr class="title">
                                <th width="20"></th>
                                <th width="100">名称</th>
                                <th width="80">类型</th>
                                <th>说明</th>
                            </tr>

                            <tr>
                                <td>&nbsp;</td>
                                <td class="url">code</td>
                                <td class="url">int</td>
                                <td>200</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                </div>
            </article>
        </div>
    </div>
    <!-- 右侧主体结束 -->
</div>
<!-- 中部结束 -->
<!-- 底部开始 -->
<div class="footer">
</div>
<!-- 底部结束 -->
</body>
<p id="baseName" style="display: none"></p>
<div id="ds" style="display: none;text-align: center;padding: 30px;">
    <div style="display: flex;justify-content: space-between">
        <div id="left" style="width: 100px;">
            <ul id="module">
            </ul>
        </div>
        <div id="right" class="layui-form">
            <div id="inpus" class="layui-input-inline">
            </div>
        </div>
    </div>
    <button style=" margin-top: 40px;" id="dm1" class="layui-btn layui-btn-danger">确定下载</button>
</div>
<script>
    layui.use(['laydate', 'form', 'layer', 'upload', 'element', 'tree'], function () {
        var layer = layui.layer;
        $("#dm").click(function () {
            $.ajax({
                type: "get",
                url: "/getOneFileString",
                success: function (data) {
                    if (data.code == undefined) {
                        $(".mds").remove();
                        for (l of data) {
                            $("#module").append(" <li class='mds' style='cursor: pointer' data-a='" + l + "'>" + l + "</li>")
                        }
                        $(".mds").click(function () {
                            l = $(this).data("a");
                            $("#baseName").text(l);
                            $.ajax({
                                type: "get",
                                url: "/getTwoFileString",
                                data: {
                                    path: l
                                },
                                success: function (data) {
                                    if (data.code == undefined) {
                                        $(".inp").remove();
                                        for (l of data) {
                                            $("#inpus").append("<div class=\"layui-unselect layui-form-checkbox inp\"><span>" + l + " </span><i class=\"layui-icon\"></i</div>")
                                        }

                                        $(".layui-unselect").click(function () {
                                            if ($(this).hasClass('layui-form-checked')) {
                                                $(this).removeClass('layui-form-checked');
                                            } else {
                                                $(this).addClass('layui-form-checked');
                                            }
                                        });
                                    } else {
                                        layer.msg("暂无数据");
                                    }
                                }
                            });
                        });
                        layer.open({
                            type: 1,
                            content: $("#ds"),
                            success: function (layero) {
                                layer.setTop(layero); //重点2
                            }
                        });
                    } else {
                        layer.msg("暂无数据");
                    }
                }
            });
        });

        $("#dm1").click(function () {
            var interfaces = "";
            $(".layui-form-checked span").each(function () {
                interfaces += $(this).text() + ","
            });
            if ($("#baseName").text() == null || $("#baseName").text() == undefined || $("#baseName").text() == '') {
                alert("请选择模块")
            } else {
                location.href = "/downLoadFile?interfaces=" + interfaces + "&module=" + $("#baseName").text();
            }
        })
    });

</script>


</html>